package com.sunshine.client.factory;

import com.sunshine.client.service.IUserApi;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author Mokairui
 * @description frame-module
 * @since 2022/5/8
 */
@Configuration
public class WebFluxClientFactoryBeanConfiguration {
    
    @Bean
    public FactoryBean<IUserApi> userApi(ProxyCreator creator) {
        return new FactoryBean<IUserApi>() {
            @Override
            public IUserApi getObject() throws Exception {
                return ((IUserApi) creator.createProxy(getObjectType()));
            }

            @Override
            public Class<?> getObjectType() {
                return IUserApi.class;
            }
        };
    }
    
}
